import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 晓星航
 * Date: 2023-09-22
 * Time: 8:21
 */
//P115第一题递归相加
public class recursionadd {
    public static int r(int b, int t) {
        if (t==0) {
            return 0;
        }
        int m = 0;
        for (int i = 0; i <= t; i++) {
            int tmp = (int)(b*Math.pow(10,i-1));
            m += tmp;
//            System.out.println("tmp"+tmp);//调试用
        }
//        System.out.println("m="+m);//调试用
        return m+r(b,t-1);
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入基数");
//        int a = 3;//方便调试，固定值
        int a = scanner.nextInt();
        System.out.println("请输入次数");
//        int b = 3;//方便调试，固定值
        int b = scanner.nextInt();
        System.out.println();
        int sum = r(a,b);
        System.out.printf("基数:%d,次数:%d,合计=%d\r\n",a,b,sum);
    }
}
